﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using IsmlTools.Common;
using IsmlTools.Dal.SQL;
using IsmlTools.Service;

namespace IsmlTools.Bil
{
    public class InitializeDb
    {
        private NameHelper _namehelper = null;

        public void Initialize()
        {
            for (int i = 2008; i <= DateTime.Now.Year; i++)
            {
                switch (i)
                {
                    case 2008:
                        break;
                    case 2009:
                        break;
                    case 2010:
                        //SaveSeasonName(i);
                        break;
                    case 2011:
                        SaveSeasonName(i);
                        SaveMatchInfo(i);
                        break;
                    case 2012:
                        //SaveSeasonName(i);
                        //SaveMatchInfo(i);
                        break;
                    case 2013:
                        //SaveSeasonName(i);
                        //SaveMatchInfo(i);
                        break;
                }
            }
        }

        public void SaveSeasonName(int year)
        {
            _namehelper = new NameHelper();

            switch (year)
            {
                case 2010:
                    _namehelper.SaveSeasonName(WebPageLink.NamesSeason2010, 3);
                    break;
                case 2011:
                    _namehelper.SaveSeasonName(WebPageLink.NamesSeason2011, 4);
                    break;
                case 2012:
                    _namehelper.SaveSeasonName(WebPageLink.NamesSeason2012, 5);
                    break;
                case 2013:
                    _namehelper.SaveSeasonName(WebPageLink.NamesSeason2013, 6);
                    break;
                default:
                    break;
            }
        }

        public void SaveMatchInfo(int year)
        {
            //using (ISMLEntities db = new ISMLEntities())
            //{
            //    Season season = new Season {Name = SeasonTitle.YearMapName[year], Year = year};
            //}

            //2012年
            SaveMatchResult resultsmanager = new SaveMatchResult();

            resultsmanager.SaveResult(year);




        }
    }
}
